/***
 * 自定义用户
 * */


//列表
function getIndex(){
    var formData = {
        aid: getAid(),
        pageStart: pages.start,
        pageLimit: pages.limit
    };
    console.log(formData);
    $.ajax({
        type: apis.userIndex.method,
        url: apis.userIndex.url,
        data: formData,
        success: function (res) {
            console.log(res);
            var h = '', tbody = $('tbody');
            if (res.code != 0) {
                h = '<tr class="text-c">';
                h += '<td colspan="10">没有记录</td>';
                h += '</tr>';
                tbody.html(h);
                return
            }
            tbody.html(getHtml(res.data));
            $('#pageTotal').html(res.total);
            pages.total = res.total;
            pageHtml(pages);
        },
        error: function () {
            console.log('网络错误');
        }
    });
}
//列表字符串
function getHtml(d){
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<tr class="text-c">';
        h += '<td>' + d[i].id + '</td>';
        h += '<td>' + d[i].uname + '</td>';
        h += '<td>';
        if (d[i].uhead == '') {
            h += '-';
        } else {
            h += '<img src="' + d[i].uhead + '" height="100"/>';
        }
        h += '</td>';
        h += '<td>' + d[i].addtime + '</td>';
        h += '<td>' + d[i].uptime + '</td>';
        h += '</tr>';
    }
    return h;
}